package com.dhcc.controller;

import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.dhcc.api.entity.User;
import com.dhcc.api.service.IUserService;

@RestController
@RequestMapping("/consumer")
public class ConsumerController {

    @DubboReference( protocol = "dubbo", interfaceClass = IUserService.class, loadbalance = "random")
    private IUserService userService;

    @RequestMapping("/selectUserById/{id}")
    public User getUser(@PathVariable("id") Long id) {
        User user = userService.selectUserById(id);
        return user;
    }
}